﻿namespace _01_Tower2._0
{
    internal class InputSystem
    {
        static private InputSystem? instance = null;
        public static InputSystem? Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new InputSystem();
                }
                return instance;
            }
        }

        ConsoleKeyInfo keyInfo;

        public InputSystem()
        {

        }
        public void Update()
        {
            keyInfo = default;
            if (Console.KeyAvailable)  // 如果我按下了按键
            {
                keyInfo = Console.ReadKey(true);
            }
        }

        public bool IsKeyPressed(ConsoleKey key)
        {

            return key == keyInfo.Key;
        }
    }
}
